﻿using MediatR;
using SheepStorage.API.Application.Command.TransferCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.TransferHandler
{
/// <summary>
/// 后裔转种删除命令处理器
/// </summary>
	public class TransferDeleteHandler : IRequestHandler<ProgenyTransferDeleteCommand, Results<int>>
	{

		private readonly IProgenyTransferService service;

		public TransferDeleteHandler(IProgenyTransferService service)
		{
			this.service = service;
		}


		/// <summary>
		/// 后裔转种删除命令处理器
		/// </summary>


		public async Task<Results<int>> Handle(ProgenyTransferDeleteCommand request, CancellationToken cancellationToken)
		{
			var result = await service.DeleteProgenyTransfer(request.ProgenyTransferId);


			return Results<int>.DataResult(result);

			//throw new NotImplementedException();
		}
	}
}
